package net.fiodor.display {
	import net.fiodor.log.Log;
	import net.fiodor.log.LogLevel;
	import net.fiodor.log.Logger;
	import net.fiodor.log.channel.FireBugChannel;
	import net.fiodor.log.channel.TraceChannel;
	
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.utils.getQualifiedClassName;		

	/**
	 * @author Tomasz Swierszcz, 
	 * email: tomasz.swierszcz@dreamlab.pl
	 */

	public class DisplayObject extends Sprite {

		private var __logger : Logger;

		public function DisplayObject() {
			
			super();
		}
		
		public function setPosition(p: Point):void{
			
			this.x = p.x;
			this.y = p.y;
		}
		
		public function getPosition() : Point {
			
			return new Point(this.x, this.y);
		}
		
		public function setSize(size: Point) : void {
			
			width = size.x;
			height = size.y; 
		}
		
		public function getSize() : Point {
			
			return getBounds(this).size;
			
		}

		
		public function getLogger() : Logger {
			
			if(!__logger) {
				__logger = Log.getLogger(getQualifiedClassName(this));
				__logger.addChannel(new TraceChannel());
				__logger.addChannel(new FireBugChannel());
			//	__logger.addChannel(new FlashDebugChannel());
				__logger.setLogLevel(LogLevel.ALL);
			}
			return __logger;
		}
		
	}
}
